import http from "../http";

interface user {
  list: (params: object) => Promise<any>;
  del: (id: number) => Promise<any>;
  create: (data: object) => Promise<any>;
  update: (id: number, data: object) => Promise<any>;
}

const userApi: user = {
  list(params) {
    return http.get("/users", params);
  },
  del(id) {
    return http.delete(`/users/${id}`);
  },
  create(data) {
    return http.post("/users", data);
  },
  update(id, data) {
    return http.patch(`/users/${id}`, data);
  },
};

export default userApi;
